package TestController;

import static org.junit.Assert.*;
import java.util.ArrayList;
import org.junit.Test;
import Task28.Command;
import Task28.Controller;
import Task28.Result;

public class TestMove {

	Result result = new Result();
	Command command = new Command();
	Controller tester = new Controller();

	private void init() {
		command.setNameCommand("move");
		command.setWorkDir("C:\\TEST2");
	}
	@Test
	public void test() {
		init();
		String[] args = null;
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}
	@Test
	public void test0() {
		init();
		String[] args = { "","" };
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}
	
	@Test
	public void test2() {
		init();
		String[] args = { "","","" };
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}
	@Test
	public void test3() {
		init();
		String[] args = { "C:\\TEST1\\notExistDir","" };//not exist
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}
	@Test
	public void test4() {
		init();
		String[] args = { "C:\\TEST1\\111","111" };//exist dir
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(aResult.isEmpty());
	}
	@Test
	public void test5() {
		init();
		String[] args = { "C:\\TEST1\\proga.exe","proga.exe" };//exist file
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(aResult.isEmpty());
	}
	@Test
	public void test6() {
		init();
		String[] args = { "C:\\TEST1\\notExist.exe","" };//not exist file
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}
	
	@Test
	public void test7() {
		init();
		String[] args = { "C:\\TEST1\\proga.exe","" };//Duplicate file
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}
	@Test
	public void test8() {
		init();
		String[] args = { "C:\\TEST1\\111","" };//Duplicate dir
		command.setArgs(args);
		
		result=tester.getResult(command);
		ArrayList<String> aResult=new ArrayList<String>();
		aResult=result.getErrors();
		
		assertTrue(!aResult.isEmpty());
	}
	@Test
	public void test9() {
		init();
		String[] args = { };
		command.setArgs(args);

		result = tester.getResult(command);
		ArrayList<String> aResult = new ArrayList<String>();
		aResult = result.getErrors();

		assertTrue(!aResult.isEmpty());
	}
}

